package vcp.enums;

import java.awt.Color;

import vcp.enums.utility.EnumReverser;
import vcp.enums.utility.EnumReverser.IEnumReverser;
/**
 * 
 * @author VCP team
 *<p> Lot status enum class </p>
 */
public enum LotStatus implements IEnumReverser
{
	FREE ( Color.GREEN, "Free" ),
	OCCUPIED ( Color.BLUE, "Occupied" ),
	RESERVE ( Color.YELLOW, "Reserve" ),
	NON_WORKING ( Color.RED, "Not Working" );

	private Color stateColor;
	/** gets state color **/
	public Color getStateColor ()
	{
		return this.stateColor;
	}

	private String name;
	/**
	 * class constructor
	 * @param color
	 * @param name
	 */
	private LotStatus ( Color color, String name )
	{
		this.stateColor = color;
		this.name = name;
	}

	@Override
	public String toString ()
	{
		return this.name;
	}
	/**
	 * converts string to enum per key
	 * @param eKey
	 * @return relevant enum
	 */
	public static LotStatus convert ( String eKey )
	{
		return EnumReverser.convert(LotStatus.class, eKey);
	}
	/**
	 * converts lot status color
	 * @param colorStatus
	 * @return color status
	 */
	public static LotStatus convert ( Color colorStatus )
	{
		LotStatus foundStatus = null;
		for ( LotStatus status : LotStatus.values() )
		{
			if ( colorStatus.equals(status.getStateColor()) )
			{
				foundStatus = status;
				break;
			}
		}

		return foundStatus;
	}

}
